% EVALUATE BASELINE
% INPUT
% baseline

% function [new,libsvmnew] = eval_baseline(baseline, NEWXTR, NEWYTR, NEWXTE, NEWYTE, settings)
function [new,libsvmnew] = eval_baseline(baseline, NEWX, NEWY, settings)

	
	[NEWX,~,~,settings] = process(NEWX,NEWX,NEWX,settings);
	
	new = {};
	[n,d] = size(NEWX);
	dv = [NEWX, ones(n,1)]*baseline.model;
	new.acc = performance(dv,NEWY,'acc');
	new.p   = dv;
	new.p(new.p >= 0) = 1;
	new.p(new.p <  0) = -1;
	new.dv  = dv;
	
	[nte,dte] = size(NEWX);
	dte = [NEWX, ones(nte,1)]*baseline.model;
	new.TE.acc = performance(dte,NEWY,'acc');
	new.TE.p   = dte;
	new.TE.p(new.TE.p >= 0) = 1;
	new.TE.p(new.TE.p <  0) = -1;
	new.TE.dv  = dte;
	
	libsvmnew = {};
	[p, a, dv] = predict(double(NEWY), sparse(double(NEWX)), baseline.libsvmmodel);
	% [pte, ate, dte] = predict(double(NEWYTE), sparse(double(NEWXTE)), baseline.libsvmmodel);
	libsvmnew.acc = performance(dv,NEWY,'acc');
	libsvmnew.p   = p;
	libsvmnew.dv  = dv;
	% libsvmnew.TE.acc = performance(dte,NEWYTE,'acc');
	% libsvmnew.TE.p   = pte;
	% libsvmnew.TE.dv  = dte;
	
end